﻿using System;
using Microsoft.TeamFoundation.VersionControl.Client;

namespace TfsPolicyPack.CustomRegexPathPolicy
{
    public class PartialPendingCheckin : IPendingCheckin
    {
        #region Non Public Fields

        private readonly IPendingCheckin _originalPendingCheckin;
        private readonly IPendingCheckinPendingChanges _matchedPendingCheckinPendingChanges;

        #endregion

        #region Properties

        public IPendingCheckinNotes CheckinNotes
        {
            get { return _originalPendingCheckin.CheckinNotes; }
        }

        public IPendingCheckinPendingChanges PendingChanges
        {
            get { return _matchedPendingCheckinPendingChanges; }
        }

        public IPendingCheckinPolicies Policies
        {
            get { return _originalPendingCheckin.Policies; }
        }

        public IPendingCheckinWorkItems WorkItems
        {
            get { return _originalPendingCheckin.WorkItems; }
        }

        #endregion

        #region Constructor

        public PartialPendingCheckin(IPendingCheckin originalPendingCheckin, PolicySettings policySettings)
        {
            _originalPendingCheckin = originalPendingCheckin;
            _matchedPendingCheckinPendingChanges = new MatchingPendingCheckinPendingChanges(_originalPendingCheckin.PendingChanges, policySettings);
        }

        #endregion

        #region Public Methods

        public object GetService(Type serviceType)
        {
            return _originalPendingCheckin.GetService(serviceType);
        }

        #endregion
    }
}